﻿using Corina.Infrastructure;
using Corina.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Corina.Web.IMS
{
    public class PageviewBase : System.Web.UI.Page
    {
        #region 上传文件类型判断

        protected readonly static List<string> VALID_FILE_TYPES = new List<string> { "jpg", "bmp", "gif", "jpeg", "png" };

        protected static bool ValidateFileType(string fileName)
        {
            string fileType = String.Empty;
            int lastDotIndex = fileName.LastIndexOf(".");
            if (lastDotIndex >= 0)
            {
                fileType = fileName.Substring(lastDotIndex + 1).ToLower();
            }

            if (VALID_FILE_TYPES.Contains(fileType))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        protected T GetInstance<T>() where T : BaseClass
        {
            return InstanceHelper.GetInstance<T>();
        }
        #endregion
    }
}